home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1998 July / EnigmA AMIGA RUN 29 (1998)(G.R. Edizioni)(IT)[!][issue 1998-07 & 08].iso / earkit / news / thor / rexx / showevent.thor < prev    next >
Text File  |  1998-05-24  |  2KB  |  83 lines

  1. /*
  2.  $VER: ShowEvent.thor 1.2 (8.6.96)
  3.  by Remco van Hooff (rvhooff@globalxs.nl)
  4.  
  5.  Shows the current event in the main window.
  6.  
  7.  1.1 - Won't exit with an arexx error when you want to show a
  8.        deleted/unrecovarable event.
  9.  1.2 - Fixed some trouble with arexx ports when ConnectThor was running.
  10. */
  11.  
  12. if left(address(), 5) = 'THOR.' then thorport = address()
  13. else do
  14.   say 'THOR port not found!'
  15.   exit
  16. end
  17.  
  18. if ~show('p', 'BBSREAD') then do
  19.   address command
  20.     "run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead"
  21.     "WaitForPort BBSREAD"
  22. end
  23.  
  24. EDF_DELETED       = '00000001'x   /* Event is deleted */
  25. EDF_UNRECOVERABLE = '00000010'x   /* Event can not be undeleted */
  26.  
  27. address(thorport)
  28. options results
  29.  
  30. GETSELECTEDEVENT
  31. if rc = 5 then do
  32.   REQUESTNOTIFY TEXT '"The events window is not open."' BT '"_Ok"'
  33.   exit
  34. end
  35. if rc = 30 then do
  36.   REQUESTNOTIFY TEXT '"'THOR.LASTERROR'"' BT '"_Ok"'
  37.   exit
  38. end
  39. event = result
  40.  
  41. CURRENTSYSTEM stem CURRENT
  42. if(rc ~= 0) then do
  43.   REQUESTNOTIFY TEXT '"'THOR.LASTERROR'"' BT '"_Ok"'
  44.   exit
  45. end
  46. bbs = '"'CURRENT.BBSNAME'"'
  47.  
  48. address BBSREAD
  49. GETBBSDATA bbsname bbs stem DATA
  50. if(rc ~= 0) then do
  51.   address(thorport)
  52.   REQUESTNOTIFY TEXT '"'BBSREAD.LASTERROR'"' BT '"_Ok"'
  53.   exit
  54. end
  55. path = DATA.BBSPATH
  56. fevent = DATA.FIRSTEVENT
  57. levent = DATA.LASTEVENT
  58. if fevent > levent then do
  59.   address(thorport)
  60.   REQUESTNOTIFY TEXT '"No event found."' BT '"_Ok"'
  61.   exit
  62. end
  63.  
  64. READBREVENT BBSNAME bbs EVENTNR event TAGSSTEM TAG DATASTEM EVENTDATA
  65. if(rc ~= 0) then do
  66.   address(thorport)
  67.   REQUESTNOTIFY TEXT '"'BBSREAD.LASTERROR'"' BT '"_Ok"'
  68.   exit
  69. end
  70. msg = path||TAG.MSGFILE
  71.  
  72. address(thorport)
  73. if bitand(EVENTDATA.FLAGS,(bitor(EDF_DELETED,EDF_UNRECOVERABLE))) = '00000000'x then do
  74.   SHOWTEXT file msg
  75.   if(rc ~= 0) then do
  76.     REQUESTNOTIFY TEXT '"'THOR.LASTERROR'"' BT '"_Ok"'
  77.     exit
  78.   end
  79. end
  80. else REQUESTNOTIFY TEXT '"Can''t display DELETED events."' BT '"_Ok"'
  81.  
  82. exit
  83.